
//时间戳转时间
export const unix2Date= (unixDate) => {
    if (unixDate){
        let date = new Date(unixDate);
        let y = date.getFullYear();
        let MM = date.getMonth() + 1;
        MM = MM < 10 ? ('0' + MM) : MM;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        let m = date.getMinutes();
        m = m < 10 ? ('0' + m) : m;
        let s = date.getSeconds();
        s = s < 10 ? ('0' + s) : s;
        return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
    }
    return "";
};

//根据被赋值的对象参数赋值
export const assignUtil=(assignObject,assignedObject)=>{
    Object.keys(assignedObject).forEach(key => {
        assignedObject[key]=assignObject[key];
    })
};

export const initField=(object)=>{
    Object.keys(object).forEach(key => {
        if (typeof (object[key]) == "number") {
            return;
        }
        object[key] = undefined;
    })
};